<div class="content-heading">
	{{('account.paymoney.chnlExpensesManage' | translate) ||'渠道费用管理'}}
</div>
<!--<div *ngIf="this.resultTable.ng2TableData.length > 0">-->
<!--主页面-->
<div>
	<div class="panel">
		<div class="panel-heading">
			<div class="row">
				<div class="col-sm-4 col-xs-12">
					<button (click)="chargeBtn()" class="btn btn-default btn-color" style="margin-right:20px">{{('account.paymoney.payment' | translate) ||'缴费'}}</button>
					<!--<button class="btn btn-default btn-color">调账</button>-->
				</div>
				<div class="col-sm-8  col-xs-12 text-right">
					<div class="form-inline">
						<a (click)="configRe.currentPage=1;searchPayRecords();payRecords.show()">{{('account.paymoney.paymentHistory' | translate) ||'历史缴费记录'}}</a>&nbsp;&nbsp;&nbsp;&nbsp;
						<!--<a href="">历史调账记录</a>&nbsp;&nbsp;&nbsp;&nbsp;-->
						<div class="form-group ">
							<input (ngModelChange)="filtChnl=$event;filtChnlName(filtChnl);" [ngModel]="filtChnl" name="chnlName" autocomplete="off"
							 type="text" class="form-control" placeholder="{{('account.paymoney.chnlNameSearchPlaceholder' | translate) ||'请输入渠道名称搜索'}} ">
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="panel-body" style="padding-top:0">
			<div class=" table-responsive">
				<table class="table table-hover table-striped">
					<thead>
						<tr>
							<th></th>
							<th>{{('account.paymoney.chnlId' | translate) ||'渠道编号'}}</th>
							<th>{{('account.paymoney.chnlName' | translate) ||'渠道名称'}}</th>
							<th>{{('account.paymoney.chnlType' | translate) ||'渠道类型'}}</th>
							<th>{{('account.paymoney.accountBalance' | translate) ||'账户余额'}}</th>
							<th>{{('account.paymoney.curMonthExpenses' | translate) ||'当月待结算费用'}}</th>
							<th>{{('account.paymoney.historyArrears' | translate) ||'历史欠费'}}</th>
						</tr>
					</thead>
					<tbody>
						<tr *ngFor="let tInfo of allDatas.tableInfo" (click)="checkChnl($event.target)">
							<td class="text-center"><input style="pointer-events:none" type="radio" name="chnlCheck" (change)="chargeInfo.chnl_id=tInfo.chnl_id.toString();chargeInfo.chnl_name=tInfo.chnl_name"></td>
							<td>{{tInfo.chnl_id}}</td>
							<td>{{tInfo.chnl_name}}</td>
							<td [ngSwitch]=tInfo.chnl_type>
								<span *ngSwitchCase="'0'" [style.color]="'#CC3299'">{{('account.paymoney.ncloud' | translate) ||'云网部门'}}</span>
								<span *ngSwitchCase="'1'" [style.color]="'#38B0DE'">{{('account.paymoney.inChnl' | translate) ||'内部渠道'}}</span>
								<span *ngSwitchDefault [style.color]="'#4D4DFF'">{{('account.paymoney.outChnl' | translate) ||'外部渠道'}}</span>
							</td>
							<td [ngClass]="tInfo.deposit_money>0?'text-danger':'text-muted'">{{tInfo.deposit_money}}</td>
							<td [ngClass]="tInfo.balance>0?'text-success':'text-muted'">{{tInfo.balance}}</td>
							<td [ngClass]="tInfo.historybalance>0?'text-warning':'text-muted'">{{tInfo.historybalance}}</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
	</div>
	<div class="text-right">
		<pagination *ngIf="config.paging" class="pagination-sm" [totalItems]="config.length" [itemsPerPage]="config.itemsPerPage"
		 [maxSize]="config.maxSize" [boundaryLinks]="true" [rotate]="false" (pageChanged)="pageChanged($event)" [firstText]="config.firstText"
		 [previousText]="config.previousText" [nextText]="config.nextText" [lastText]="config.lastText">
		</pagination>
	</div>
</div>
<!-- table end -->
<!--modal start -->
<!--缴费弹框-->
<div class="modal fade" bsModal #payment="bs-modal" [config]="{backdrop: false}" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel"
 aria-hidden="true">
	<div class="modal-dialog modal-md">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" aria-label="Close" (click)="payment.hide()">
                    <span aria-hidden="true">&times;</span>
                </button>
				<h4 class="modal-title">{{('account.paymoney.charge' | translate) ||'充 值'}}
					<small class='text-warning'> - {{chargeInfo.chnl_name}}</small>
				</h4>
			</div>
			<div class="modal-body">
				<form class="form-horizontal" #chargeForm="ngForm">
					<div class="form-group">
						<label class="col-sm-3 control-label" for="chargeType">{{('account.paymoney.chargeType' | translate) ||'充值类型'}}</label>
						<div class="col-sm-8">
							<div class="radio">
								<label>
          							<input type="radio" name="chargeType" value="1" id="chargeType" checked  (change)="chargeInfo.type=$event.target.value">{{('account.paymoney.chnlSettleAccounts' | translate) ||'渠道结算'}}
        						</label>
								<!--<span [class]="chargeInfo.type=='1'?'glyphicon glyphicon-ok text-success':'glyphicon glyphicon-remove text-danger'" style="float:right"></span>-->
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label" for="chargeValue">{{('account.paymoney.chargeAmount' | translate) ||'充值金额'}}</label>
						<div class="col-sm-8">
							<input (input)="upDigit($event.target.value)" name="chargeValue" type="text" class="form-control" id="chargeValue" [(ngModel)]="chargeInfo.value"
							 #chargeValue="ngModel" required autocomplete="off" placeholder="{{('account.paymoney.chargeAmountPlaceholder' | translate) ||'请输入充值金额'}}">
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-offset-3 col-sm-8" [style.color]="chargeInfo.data==='0'?'#aaa':'#007FFF'">
							{{('account.paymoney.currencyUnit' | translate) ||'¥'}} {{ chargeInfo.data | number:'1.2-2'}}
							<p [class]="'text-danger'" *ngIf="chargeInfo.errInfo.length>0">{{this.chargeInfo.errInfo}}</p>
						</div>
					</div>
					<div class="form-group text-right">
						<div class="col-sm-offset-7 col-sm-2">
							<button class="mb-sm btn btn-primary btn-outline" type="button" (click)="payment.hide();">{{('account.paymoney.cancel' | translate) ||'取消'}}</button>
						</div>
						<div class="col-sm-2">
							<button class="mb-sm btn btn-primary btn-outline" type="button" [disabled]="!chargeForm.form.valid||chargeInfo.able" (click)="chargeSubmit()">{{('account.paymoney.confirm' | translate) ||'确定'}}</button>
						</div>
					</div>
				</form>
			</div>
			<!--<div class="modal-footer">
				<button class="mb-sm btn btn-primary btn-outline" type="button" (click)="payment.hide();">取消</button>&nbsp;&nbsp;&nbsp;&nbsp;
				<button class="mb-sm btn btn-primary btn-outline" type="button" [disabled]="!chargeForm.form.valid||chargeInfo.able" (click)="chargeSubmit()">确定</button>
			</div>-->
		</div>
	</div>
</div>
<!-- modal end -->
<!--modal start -->
<!--缴费记录-->
<div class="modal fade" bsModal #payRecords="bs-modal" [config]="{backdrop: false}" tabindex="1" role="dialog" aria-labelledby="mySmallModalLabel"
 aria-hidden="true">
	<div class="modal-dialog modal-lg">
		<div class="modal-content" style="top:40px">
			<div class="modal-header">
				<button type="button" class="close" aria-label="Close" (click)="payRecords.hide()">
                    <span aria-hidden="true">&times;</span>
                </button>
				<h4 class="modal-title">{{('account.paymoney.chargeRecord' | translate) ||'充值记录'}}</h4>
			</div>
			<div class="modal-body" style="padding-bottom:0px">
				<div class="panel">
					<div class="panel-heading">
						<form class="form-horizontal">
							<div class="form-group text-right">
								<label class="control-label col-md-1 col-md-offset-5" style="padding-left:0;padding-right:0;">{{('account.paymoney.beginDate' | translate) ||'起始时间'}}:</label>
								<div class="col-md-2">
									<datetime [datepicker]="datepickerOpts" name="beginTime" [(ngModel)]="dateInfo.begin"></datetime>
								</div>
								<label class="control-label col-md-1" style="padding-left:0;padding-right:0">{{('account.paymoney.endDate' | translate) ||'截止时间'}}:</label>
								<div class="col-md-2">
									<datetime [datepicker]="datepickerOpts" name="endTime" [(ngModel)]="dateInfo.end"></datetime>
								</div>
								<div class="col-md-1" style="padding-left:0">
									<input type="submit" class="btn btn-primary " (click)="configRe.currentPage=1;searchPayRecords()" value="{{('account.paymoney.search' | translate) ||'查询'}}">
								</div>
							</div>
						</form>
						<!--<div class="row">-->
						<!--<div class="col-sm-3">-->
						<!--<div class="form-group has-feedback">-->
						<!--<input (ngModelChange)="chnlFilt.name=$event;filtPayRecords(chnlFilt);" [ngModel]="chnlFilt.name" name="chnlName" autocomplete="off"  type="text" class="form-control" placeholder=" 请输入渠道名称搜索">-->
						<!--<span class="glyphicon glyphicon-search form-control-feedback"></span>-->
						<!--</div>							-->
						<!--</div>	 -->
						<!--</div>		-->
					</div>
					<div class="panel-body" style="padding-top:0">
						<div class=" table-responsive">
							<table class="table table-hover table-condensed table-striped">
								<thead>
									<tr>
										<th>{{('account.paymoney.date' | translate) ||'日期'}}</th>
										<th>{{('account.paymoney.chnlName' | translate) ||'渠道名称'}}</th>
										<th>
											{{('account.paymoney.chnlType' | translate) ||'渠道类型'}}
											<!--<select [ngModel]="chnlFilt.cType" name="chnlType" (ngModelChange)="chnlFilt.cType=$event;filtPayRecords(chnlFilt)">
    											<option value="0">云网部门</option>
    											<option value="1">内部渠道</option>
    											<option value='2'>外部渠道</option>  
											</select>-->
										</th>
										<th>{{('account.paymoney.dealType' | translate) ||'交易类型'}}</th>
										<th>{{('account.paymoney.money' | translate) ||'金额'}}</th>
										<th>{{('account.paymoney.operator' | translate) ||'操作人员'}}</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let pInfo of allDatas.payRecordsInfo">
										<td>{{pInfo.recv_time}}</td>
										<td>{{pInfo.chnl_name}}</td>
										<td [ngSwitch]=pInfo.chnl_type>
											<span *ngSwitchCase="'0'" [style.color]="'#CC3299'">{{('account.paymoney.ncloud' | translate) ||'云网部门'}}</span>
											<span *ngSwitchCase="'1'" [style.color]="'#38B0DE'">{{('account.paymoney.inChnl' | translate) ||'内部渠道'}}</span>
											<span *ngSwitchDefault [style.color]="'#4D4DFF'">{{('account.paymoney.outChnl' | translate) ||'外部渠道'}}</span>
										</td>
										<td [ngSwitch]=pInfo.recv_type>
											<span *ngSwitchCase="'1'">{{('account.paymoney.charge' | translate) ||'充值'}}</span>
											<span *ngSwitchDefault>{{('account.paymoney.chargeOff' | translate) ||'销账'}}</span>
										</td>
										<td>{{pInfo.recv_fee}}</td>
										<td>{{pInfo.account}}</td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
					<div class="text-right">
						<pagination *ngIf="configRe.paging" class="pagination-sm" [totalItems]="configRe.length" [(ngModel)]="configRe.currentPage"
						 [itemsPerPage]="configRe.itemsPerPage" [maxSize]="configRe.maxSize" [boundaryLinks]="true" [rotate]="false" (pageChanged)="pageChangedRe($event)"
						 [firstText]="config.firstText" [previousText]="config.previousText" [nextText]="config.nextText" [lastText]="config.lastText">
						</pagination>
					</div>
				</div>
			</div>
			<!--<div class="modal-footer">
				<p>{{config.page}}</p>
			</div>-->
		</div>
	</div>
</div>
<!-- modal end -->